//
//  SYDynamicTableViewCell.m
//  ChatDemo-UI2.0
//
//  Created by zz on 16/11/25.
//  Copyright © 2016年 zz. All rights reserved.
//

#import "SYDynamicTableViewCell.h"

@implementation SYDynamicTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        //头像
        _avater = [[UIImageView alloc] initWithFrame:CGRectMake(11, 5, 42, 42)];
        _avater.clipsToBounds = YES;
        _avater.contentMode = UIViewContentModeScaleAspectFill;
        _avater.layer.cornerRadius = 21;
        [self.contentView addSubview:_avater];
    
        //昵称
        _nickNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(64, 5, SCREENWIDTH - 11 - 64, 20)];
        _nickNameLabel.font = [UIFont systemFontOfSize:15];
        _nickNameLabel.textColor = RGBACOLOR(56, 112, 193, 1);
        _nickNameLabel.backgroundColor =[UIColor clearColor] ;
        _nickNameLabel.textAlignment = NSTextAlignmentLeft;
        [self addSubview:_nickNameLabel];
        
        //内容
        _contentLabel = [[UILabel alloc] initWithFrame:CGRectMake(_nickNameLabel.frame.origin.x, _nickNameLabel.frame.origin.y + _nickNameLabel.frame.size.height + 3, _nickNameLabel.frame.size.width, 0)];
        _contentLabel.textColor = [UIColor blackColor];
        _contentLabel.font = [UIFont systemFontOfSize:KDynamicContentFont];
        _contentLabel.backgroundColor = [UIColor clearColor];
        _contentLabel.numberOfLines = 0;
        [self addSubview:_contentLabel];
        
        //时间
        _timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(64, self.frame.size.height - 8,_timeLabel.frame.size.width,20)];
        _timeLabel.font = [UIFont systemFontOfSize:13];
        _timeLabel.textAlignment = NSTextAlignmentLeft;
        _timeLabel.textColor = RGBACOLOR(120, 120, 120, 1);
        [self addSubview:_timeLabel];
        
        //删除按钮
        _delButton = [UIButton buttonWithType:UIButtonTypeCustom];
        _delButton.frame = CGRectMake(CGRectGetMaxX(_timeLabel.frame) + 5, self.frame.size.height - 8, 50, 20);
        [_delButton setTitle:@"删除" forState:UIControlStateNormal];
        [_delButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
        _delButton.titleLabel.font = [UIFont systemFontOfSize:13];
        [self.contentView addSubview:_delButton];
        
        //交互按钮
        _touchButton =[UIButton buttonWithType:UIButtonTypeCustom];
        [_touchButton setImage:[UIImage imageNamed:@"tanchu_fx_nor"] forState:UIControlStateNormal];
        [self addSubview:_touchButton];
        
        //评论与点赞视图
        _likeCommentView = [[replayView alloc] initWithFrame:CGRectMake(0, 0, SCREENWIDTH - 75, 10)];
        [self.contentView addSubview:_likeCommentView];
    }
    
    return self;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
